<html>
<head>
    <title>激活码页</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
</head>
<body>

手机ID: <input id="phoneId" type="text" name="fname"/>
<br>
激活密钥: <input id="password" type="text" name="lname"/>
<br>
<input type="submit" value="获取密钥" onclick="jihuo()"/>

<h2>激活密钥</h2>
<div id="keydiv">Hello World</div>
<br>
<btn class="btn btn-sm btn-default" onclick="copyText()">点此复制</btn>
</body>
<script>
    function copyText() {
        var Url2 = document.getElementById("keydiv").innerText;
        var oInput = document.createElement('input');
        oInput.value = Url2;
        document.body.appendChild(oInput);
        oInput.select();
        document.execCommand("Copy");
        oInput.className = 'oInput';
        oInput.style.display = 'none';
        alert('复制成功');
    }

    function jihuo() {
        var phoneId = document.getElementById("phoneId").value;
        var password = document.getElementById("password").value;
        var keydiv = document.getElementById("keydiv");
        if (md5(password) == "b29a2abe59b0ede6f631235ccd943171") {
            var newStr = md5(phoneId + "19950601").toUpperCase();
            keydiv.innerHTML = newStr.substring(0, 6);

        } else {
            keydiv.innerHTML = "未输入正确的Password";
        }
    }
</script>
</html>